#define _CRT_SECURE_NO_WARNINGS 1
#pragma once
#include "HashTable.hpp"

namespace sk
{
	template<class K, class HashFunc = Hash<K>>
	class unordered_set
	{
		struct SetKeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
	public:
		typedef typename LinkHash::HashTable<K, K, SetKeyOfT, HashFunc>::iterator iterator;

		iterator begin()
		{
			return _ht.begin();
		}
		iterator end()
		{
			return _ht.end();
		}
		pair<iterator, bool> insert(const K& key)
		{
			return _ht.insert(key);
		}
	private:
		LinkHash::HashTable<K, K, SetKeyOfT, HashFunc> _ht;
	};

	void test_unordered_set()
	{
		unordered_set<string> us;
		us.insert("10");
		us.insert("12");
		us.insert("11");
		us.insert("20");
		us.insert("22");

		unordered_set<string> us1(us);
		unordered_set<string> us2 = us1;

		unordered_set<string>::iterator it = us.begin();
		for (auto &e : us2)
		{
			cout << e << endl;
		}
		cout << endl;
	}
}